Support attaching multiple images to a single chat message - #742
Open
mattlindsey wants to merge 1 commit into
Open
Support attaching multiple images to a single chat message#742mattlindsey wants to merge 1 commit into
mattlindsey wants to merge 1 commit into
Conversation
The message/document data layer already supported multiple documents per message (has_many :documents, all three AIBackend providers already looped over them), but the composer UI, upload controller, and message display only ever handled one. - Message::DocumentImage: replace .first/.last helpers with aggregate has_document_image?/has_document_pdf?/has_documents? checks; the view now reads per-document data straight off Document. - Composer: file picker accepts multiple files, preview box becomes a cloneable template instead of one static slot. - image_upload_controller.js: track an ordered list of attached files. Uses a separate, unnamed <input multiple> purely to trigger the OS file dialog, keeping the real Rails-nested-attributes inputs single-file always — a multiple file input left empty submits a blank value instead of being omitted, which would 422 every send. - Message display: loop over documents, giving each image its own modal controller/dialog instead of sharing one per message. - Add Gemini multi-image payload test to match existing OpenAI/ Anthropic coverage. Closes #78 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
Author
|
This was done entirely by Claude Code and works for OpenAI but it seems like Anthropic vision might not be working (even before this PR), so probably that should be investigated first. Also I couldn't manually verify Gemini (api key permission problems). And I probably shouldn't be adding a new major ai feature before we do #740. |
Collaborator
Author
|
Actually this PR works for OpenAI and Anthropic (user error with key). So, for example, you can add 2 images in 1 message and ask it to compare them. Still need to figure out key problem with Gemini. The new key process is complicated. P.S. This works now for OpenAI, Anthropic, and Gemini. So I'm taking off of Draft. |
mattlindsey
marked this pull request as ready for review
July 27, 2026 13:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The message/document data layer already supported multiple documents per message (has_many :documents, all three AIBackend providers already looped over them), but the composer UI, upload controller, and message display only ever handled one.
Closes #78